|
1
|
|
|
/* |
|
2
|
|
|
* Circles - Bring cloud-users closer together. |
|
3
|
|
|
* |
|
4
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
|
5
|
|
|
* later. See the COPYING file. |
|
6
|
|
|
* |
|
7
|
|
|
* @author Maxence Lange <[email protected]> |
|
8
|
|
|
* @copyright 2017 |
|
9
|
|
|
* @license GNU AGPL version 3 or any later version |
|
10
|
|
|
* |
|
11
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
12
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
13
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
14
|
|
|
* License, or (at your option) any later version. |
|
15
|
|
|
* |
|
16
|
|
|
* This program is distributed in the hope that it will be useful, |
|
17
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19
|
|
|
* GNU Affero General Public License for more details. |
|
20
|
|
|
* |
|
21
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
22
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
23
|
|
|
* |
|
24
|
|
|
*/ |
|
25
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
/** global: OC */ |
|
28
|
|
|
|
|
29
|
|
|
var elements = { |
|
30
|
|
|
allow_linked_groups: null, |
|
31
|
|
|
allow_federated_circles: null |
|
32
|
|
|
}; |
|
33
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
$(document).ready(function () { |
|
36
|
|
|
|
|
37
|
|
|
elements.allow_linked_groups = $('#allow_linked_groups'); |
|
38
|
|
|
elements.allow_federated_circles = $('#allow_federated_circles'); |
|
39
|
|
|
|
|
40
|
|
|
elements.allow_linked_groups.on('change', function () { |
|
41
|
|
|
saveChange(); |
|
42
|
|
|
}); |
|
43
|
|
|
elements.allow_federated_circles.on('change', function () { |
|
44
|
|
|
saveChange(); |
|
45
|
|
|
}); |
|
46
|
|
|
|
|
47
|
|
|
saveChange = function () { |
|
|
|
|
|
|
48
|
|
|
$.ajax({ |
|
49
|
|
|
method: 'POST', |
|
50
|
|
|
url: OC.generateUrl('/apps/circles/admin/settings'), |
|
51
|
|
|
data: { |
|
52
|
|
|
allow_linked_groups: (elements.allow_linked_groups.is( |
|
53
|
|
|
':checked')) ? '1' : '0', |
|
54
|
|
|
allow_federated_circles: (elements.allow_federated_circles.is( |
|
55
|
|
|
':checked')) ? '1' : '0' |
|
56
|
|
|
} |
|
57
|
|
|
}).done(function (res) { |
|
58
|
|
|
elements.allow_linked_groups.prop('checked', (res.allowLinkedGroups === '1')); |
|
59
|
|
|
elements.allow_federated_circles.prop('checked', (res.allowFederatedCircles === '1')); |
|
60
|
|
|
}); |
|
61
|
|
|
}; |
|
62
|
|
|
|
|
63
|
|
|
$.ajax({ |
|
64
|
|
|
method: 'GET', |
|
65
|
|
|
url: OC.generateUrl('/apps/circles/admin/settings'), |
|
66
|
|
|
data: {} |
|
67
|
|
|
}).done(function (res) { |
|
68
|
|
|
elements.allow_federated_circles.prop('checked', (res.allowLinkedGroups === '1')); |
|
69
|
|
|
elements.allow_federated_circles.prop('checked', (res.allowFederatedCircles === '1')); |
|
70
|
|
|
}); |
|
71
|
|
|
|
|
72
|
|
|
}); |